<template>
  <div class="visual-container">
    <!-- 头部 -->
    <header>
      <h1>航班航迹监控</h1>
      <div class="clock">
        <Clock></Clock>
      </div>
    </header>

    <!-- 页面主体部分 -->
    <div>
      <section class="main-box">


        <!-- 左侧盒子 -->
        <div class="column">
          <!-- 公共面板 -->
          <div class="panel-top">
            <h2>当日航班排名</h2>
            <div class="chart">
              <section class="left-top-box">
                <div class="column">
                  <h3>航班</h3>
                  <div class="panel-rank">
                    <h4>排名</h4>
                    <h4>航司</h4>
                    <h4>架次</h4>
                  </div>
                  <div class="panel-rank">
                    <p>1</p>
                    <p v-text="flights_rank.rank1.IATA"></p>
                    <p v-text="flights_rank.rank1.num"></p>
                  </div>
                  <div class="panel-rank">
                    <p>2</p>
                    <p v-text="flights_rank.rank2.IATA"></p>
                    <p v-text="flights_rank.rank2.num"></p>
                  </div>
                  <div class="panel-rank">
                    <p>3</p>
                    <p v-text="flights_rank.rank3.IATA"></p>
                    <p v-text="flights_rank.rank3.num"></p>
                  </div>
                </div>
                <div class="column">
                  <h3>旅客</h3>
                  <div class="panel-rank">
                    <h4>排名</h4>
                    <h4>航司</h4>
                    <h4>架次</h4>
                  </div>
                  <div class="panel-rank">
                    <p>1</p>
                    <p v-text="passengers_rank.rank1.IATA"></p>
                    <p v-text="passengers_rank.rank1.num"></p>
                  </div>
                  <div class="panel-rank">
                    <p>2</p>
                    <p v-text="passengers_rank.rank2.IATA"></p>
                    <p v-text="passengers_rank.rank2.num"></p>
                  </div>
                  <div class="panel-rank">
                    <p>3</p>
                    <p v-text="passengers_rank.rank3.IATA"></p>
                    <p v-text="passengers_rank.rank3.num"></p>
                  </div>
                </div>
                <div class="column">
                  <h3>货邮</h3>
                  <div class="panel-rank">
                    <h4>排名</h4>
                    <h4>航司</h4>
                    <h4>架次</h4>
                  </div>
                  <div class="panel-rank">
                    <p>1</p>
                    <p v-text="shipment_rank.rank1.IATA"></p>
                    <p v-text="shipment_rank.rank1.num"></p>
                  </div>
                  <div class="panel-rank">
                    <p>2</p>
                    <p v-text="shipment_rank.rank2.IATA"></p>
                    <p v-text="shipment_rank.rank2.num"></p>
                  </div>
                  <div class="panel-rank">
                    <p>3</p>
                    <p v-text="shipment_rank.rank3.IATA"></p>
                    <p v-text="shipment_rank.rank3.num"></p>
                  </div>
                </div>
              </section>
            </div>
            <!-- 用于绘制底部边框四角 -->
            <div class="panel-footer">
            </div>
          </div>
          <!-- 进港航班列表 -->
          <div class="panel-bottom">
            <h2>进港航班</h2>
            <div class="table-wrapper">
              <el-table
                class="chart"
                :data="entryFlights"
                height="6.8rem"
                border
                style="width: 100%"
                :default-sort="{prop: 'estimate_takeoff_time', order: 'ascending'}"
              >
                <el-table-column
                  fixed
                  prop="flights_number"
                  label="航班号"
                  width="80">
                </el-table-column>
                <el-table-column
                  fixed
                  prop="destination"
                  label="目的地"
                  width="90">
                </el-table-column>
                <el-table-column
                  prop="estimate_takeoff_time"
                  label="预计起飞"
                  width="60">
                </el-table-column>
                <el-table-column
                  prop="boarding_floor"
                  label="乘机楼"
                  width="70">
                </el-table-column>
                <el-table-column
                  prop="status"
                  label="状态"
                >
                </el-table-column>
              </el-table>
            </div>


            <!-- 用于绘制底部边框四角 -->
            <div class="panel-footer">
            </div>
          </div>
        </div>


        <!-- 中间盒子 -->
        <div class="column">
          <!-- 航班流量统计模块 -->
          <div class="flights_rank">
            <div class="flights_rank-number">
              <ul>
                <li id="li-1" v-text="entryFlightsCount"></li>
                <li id="li-2" v-text="departureFlightsCount"></li>
              </ul>
            </div>
            <div class="flights_rank-title">
              <ul>
                <li>进港航班数</li>
                <li>离港航班数</li>
              </ul>
            </div>
          </div>
          <!-- 地图模块 -->
          <div class="map">

            <div class="map-ball"></div>
            <div class="map-rotate1"></div>
            <div class="map-rotate2"></div>
            <div class="map-chart" ref="Flights_trajectory_ref">
            </div>
          </div>
        </div>


        <!-- 右侧盒子 -->
        <div class="column">
          <div class="panel-top">
            <h2>当日流量统计</h2>
            <div class="chart">
              <div class="right-top-box" >
                <div class="line">
                  <span class="iconfont icon-ai-connection"></span>
                  <span class="span_title">客流量</span>
                  <span class="span_value">{{passengers_count}} 人</span>
                </div>
                <div class="line">
                  <span class="iconfont icon-jiesongjifuwu"></span>
                  <span class="span_title">起降架次</span>
                  <span class="span_value">{{flights_count}} 架</span>
                </div>
                <div class="line">
                  <span class="iconfont icon-huowu"></span>
                  <span class="span_title">货邮</span>
                  <span class="span_value">{{shipment_count}} 吨</span>
                </div>
              </div>
            </div>
            <!-- 用于绘制底部边框四角 -->
            <div class="panel-footer"></div>
          </div>
          <!-- 离港航班列表 -->
          <div class="panel-bottom">
            <h2>离港航班</h2>
            <div class="table-wrapper">
              <el-table
                class="chart"
                :data="departureFlights"
                height="6.8rem"
                border
                style="width: 100%"
                :default-sort="{prop: 'estimate_takeoff_time', order: 'ascending'}"
              >
                <el-table-column
                  fixed
                  prop="flights_number"
                  label="航班号"
                  width="80">
                </el-table-column>
                <el-table-column
                  fixed
                  prop="departure_place"
                  label="出发地"
                  width="90">
                </el-table-column>
                <el-table-column
                  prop="estimate_takeoff_time"
                  label="预计起飞"
                  width="60">
                </el-table-column>
                <el-table-column
                  prop="boarding_floor"
                  label="乘机楼"
                  width="70">
                </el-table-column>
                <el-table-column
                  prop="status"
                  label="状态"
                >
                </el-table-column>
              </el-table>
            </div>

            <!-- 用于绘制底部边框四角 -->
            <div class="panel-footer">
            </div>
          </div>
        </div>
      </section>
    </div>

  </div>

</template>


<script>
  import china from '../resource/maps/china.js'

  import Scheduled_entry_flights from '../components/flights_monitor/Scheduled_entry_flights'
  import Scheduled_departure_flights from '../components/flights_monitor/Scheduled_departure_flights'
  import Clock from '../components/flights_monitor/Clock'

  var geoCoordMap = {
    '上海': [121.4648, 31.2891],
    '东莞': [113.8953, 22.901],
    '东营': [118.7073, 37.5513],
    '中山': [113.4229, 22.478],
    '临汾': [111.4783, 36.1615],
    '临沂': [118.3118, 35.2936],
    '丹东': [124.541, 40.4242],
    '丽水': [119.5642, 28.1854],
    '乌鲁木齐': [87.9236, 43.5883],
    '佛山': [112.8955, 23.1097],
    '保定': [115.0488, 39.0948],
    '兰州': [103.5901, 36.3043],
    '包头': [110.3467, 41.4899],
    '北京': [116.4551, 40.2539],
    '北海': [109.314, 21.6211],
    '南京': [118.8062, 31.9208],
    '南宁': [108.479, 23.1152],
    '南昌': [116.0046, 28.6633],
    '南通': [121.1023, 32.1625],
    '厦门': [118.1689, 24.6478],
    '台州': [121.1353, 28.6688],
    '合肥': [117.29, 32.0581],
    '呼和浩特': [111.4124, 40.4901],
    '咸阳': [108.4131, 34.8706],
    '哈尔滨': [127.9688, 45.368],
    '唐山': [118.4766, 39.6826],
    '嘉兴': [120.9155, 30.6354],
    '大同': [113.7854, 39.8035],
    '大连': [122.2229, 39.4409],
    '天津': [117.4219, 39.4189],
    '太原': [112.3352, 37.9413],
    '威海': [121.9482, 37.1393],
    '宁波': [121.5967, 29.6466],
    '宝鸡': [107.1826, 34.3433],
    '宿迁': [118.5535, 33.7775],
    '常州': [119.4543, 31.5582],
    '广州': [113.5107, 23.2196],
    '廊坊': [116.521, 39.0509],
    '延安': [109.1052, 36.4252],
    '张家口': [115.1477, 40.8527],
    '徐州': [117.5208, 34.3268],
    '德州': [116.6858, 37.2107],
    '惠州': [114.6204, 23.1647],
    '成都': [103.9526, 30.7617],
    '扬州': [119.4653, 32.8162],
    '承德': [117.5757, 41.4075],
    '拉萨': [91.1865, 30.1465],
    '无锡': [120.3442, 31.5527],
    '日照': [119.2786, 35.5023],
    '昆明': [102.9199, 25.4663],
    '杭州': [119.5313, 29.8773],
    '枣庄': [117.323, 34.8926],
    '柳州': [109.3799, 24.9774],
    '株洲': [113.5327, 27.0319],
    '武汉': [114.3896, 30.6628],
    '汕头': [117.1692, 23.3405],
    '江门': [112.6318, 22.1484],
    '沈阳': [123.1238, 42.1216],
    '沧州': [116.8286, 38.2104],
    '河源': [114.917, 23.9722],
    '泉州': [118.3228, 25.1147],
    '泰安': [117.0264, 36.0516],
    '泰州': [120.0586, 32.5525],
    '济南': [117.1582, 36.8701],
    '济宁': [116.8286, 35.3375],
    '海口': [110.3893, 19.8516],
    '淄博': [118.0371, 36.6064],
    '淮安': [118.927, 33.4039],
    '深圳': [114.5435, 22.5439],
    '清远': [112.9175, 24.3292],
    '温州': [120.498, 27.8119],
    '渭南': [109.7864, 35.0299],
    '湖州': [119.8608, 30.7782],
    '湘潭': [112.5439, 27.7075],
    '滨州': [117.8174, 37.4963],
    '潍坊': [119.0918, 36.524],
    '烟台': [120.7397, 37.5128],
    '玉溪': [101.9312, 23.8898],
    '珠海': [113.7305, 22.1155],
    '盐城': [120.2234, 33.5577],
    '盘锦': [121.9482, 41.0449],
    '石家庄': [114.4995, 38.1006],
    '福州': [119.4543, 25.9222],
    '秦皇岛': [119.2126, 40.0232],
    '绍兴': [120.564, 29.7565],
    '聊城': [115.9167, 36.4032],
    '肇庆': [112.1265, 23.5822],
    '舟山': [122.2559, 30.2234],
    '苏州': [120.6519, 31.3989],
    '莱芜': [117.6526, 36.2714],
    '菏泽': [115.6201, 35.2057],
    '营口': [122.4316, 40.4297],
    '葫芦岛': [120.1575, 40.578],
    '衡水': [115.8838, 37.7161],
    '衢州': [118.6853, 28.8666],
    '西宁': [101.4038, 36.8207],
    '西安': [109.1162, 34.2004],
    '贵阳': [106.6992, 26.7682],
    '连云港': [119.1248, 34.552],
    '邢台': [114.8071, 37.2821],
    '邯郸': [114.4775, 36.535],
    '郑州': [113.4668, 34.6234],
    '鄂尔多斯': [108.9734, 39.2487],
    '重庆': [107.7539, 30.1904],
    '金华': [120.0037, 29.1028],
    '铜川': [109.0393, 35.1947],
    '银川': [106.3586, 38.1775],
    '镇江': [119.4763, 31.9702],
    '长春': [125.8154, 44.2584],
    '长沙': [113.0823, 28.2568],
    '长治': [112.8625, 36.4746],
    '阳泉': [113.4778, 38.0951],
    '青岛': [120.4651, 36.3373],
    '韶关': [113.7964, 24.7028]
  }

  // 离港航班
  var Departure_flights = [
    [{ name: '重庆' }, {
      name: '北京',
      value: 100
    }],
    [{ name: '重庆' }, {
      name: '上海',
      value: 100
    }],
    [{ name: '重庆' }, {
      name: '广州',
      value: 100
    }],
    [{ name: '重庆' }, {
      name: '呼和浩特',
      value: 100
    }],
    [{ name: '重庆' }, {
      name: '银川',
      value: 100
    }]
  ]
  // 入港航班
  var Entry_flights = [
    [{ name: '北京' }, {
      name: '重庆',
      value: 100
    }],
    [{ name: '拉萨' }, {
      name: '重庆',
      value: 100
    }],
    [{ name: '成都' }, {
      name: '重庆',
      value: 100
    }],
    [{ name: '乌鲁木齐' }, {
      name: '重庆',
      value: 100
    }],
    [{ name: '哈尔滨' }, {
      name: '重庆',
      value: 100
    }]
  ]

  var planePath = 'path://M1705.06,1318.313v-89.254l-319.9-221.799l0.073-208.063c0.521-84.662-26.629-121.796-63.961-121.491c-37.332-0.305-64.482,36.829-63.961,121.491l0.073,208.063l-319.9,221.799v89.254l330.343-157.288l12.238,241.308l-134.449,92.931l0.531,42.034l175.125-42.917l175.125,42.917l0.531-42.034l-134.449-92.931l12.238-241.308L1705.06,1318.313z'

  var convertData = function (data) {
    var res = []
    for (var i = 0; i < data.length; i++) {

      var dataItem = data[i]

      var fromCoord = geoCoordMap[dataItem[0].name]
      var toCoord = geoCoordMap[dataItem[1].name]
      if (fromCoord && toCoord) {
        res.push({
          fromName: dataItem[0].name,
          toName: dataItem[1].name,
          coords: [fromCoord, toCoord],
          value: dataItem[1].value
        })
      }
    }

    return res

  }

  var color = ['#a6c84c', '#ffa022', '#46bee9']//航线的颜色
  var series = []

  export default {
    name: 'test',
    components: {
      Scheduled_departure_flights: Scheduled_departure_flights,
      Scheduled_entry_flights: Scheduled_entry_flights,
      Clock: Clock
    },
    data () {
      return {
        chartInstance: null,
        entryFlightsCount: 1234,
        departureFlightsCount: 5678,
        timer: null,
        entryFlights: [
          {
            flights_number: 'MF8071',
            estimate_takeoff_time: '13:00',
            destination: '昆明',
            boarding_floor: 'T3',
            status: '正常'
          }, {
            flights_number: 'MF8071',
            estimate_takeoff_time: '16:00',
            destination: '昆明',
            boarding_floor: 'T3',
            status: '正常'
          }, {
            flights_number: 'MF8071',
            estimate_takeoff_time: '14:00',
            destination: '昆明',
            boarding_floor: 'T3',
            status: '正常'
          }, {
            flights_number: 'MF8071',
            estimate_takeoff_time: '16:00',
            destination: '昆明',
            boarding_floor: 'T3',
            status: '正常'
          }, {
            flights_number: 'MF8071',
            estimate_takeoff_time: '15:00',
            destination: '昆明',
            boarding_floor: 'T3',
            status: '正常'
          }, {
            flights_number: 'MF8071',
            estimate_takeoff_time: '16:00',
            destination: '昆明',
            boarding_floor: 'T3',
            status: '正常'
          }, {
            flights_number: 'MF8071',
            estimate_takeoff_time: '18:00',
            destination: '昆明',
            boarding_floor: 'T3',
            status: '正常'
          }, {
            flights_number: 'MF8071',
            estimate_takeoff_time: '16:00',
            destination: '昆明',
            boarding_floor: 'T3',
            status: '正常'
          }, {
            flights_number: 'MF8071',
            estimate_takeoff_time: '16:00',
            destination: '昆明',
            boarding_floor: 'T3',
            status: '正常'
          }, {
            flights_number: 'MF8071',
            estimate_takeoff_time: '18:00',
            destination: '昆明',
            boarding_floor: 'T3',
            status: '正常'
          }, {
            flights_number: 'MF8071',
            estimate_takeoff_time: '16:00',
            destination: '昆明',
            boarding_floor: 'T3',
            status: '正常'
          }],
        departureFlights: [
          {
            flights_number: 'MF8071',
            estimate_takeoff_time: '12:00',
            departure_place: '哈尔滨',
            boarding_floor: 'T3',
            status: '正常'
          }, {
            flights_number: 'MF8071',
            estimate_takeoff_time: '08:00',
            departure_place: '北京',
            boarding_floor: 'T3',
            status: '正常'
          }, {
            flights_number: 'MF8071',
            estimate_takeoff_time: '19:00',
            departure_place: '天津',
            boarding_floor: 'T3',
            status: '正常'
          }, {
            flights_number: 'MF8071',
            estimate_takeoff_time: '16:00',
            departure_place: '哈尔滨',
            boarding_floor: 'T3',
            status: '正常'
          }, {
            flights_number: 'MF8071',
            estimate_takeoff_time: '13:00',
            departure_place: '哈尔滨',
            boarding_floor: 'T3',
            status: '正常'
          }, {
            flights_number: 'MF8071',
            estimate_takeoff_time: '16:00',
            departure_place: '哈尔滨',
            boarding_floor: 'T3',
            status: '正常'
          }, {
            flights_number: 'MF8071',
            estimate_takeoff_time: '16:00',
            departure_place: '哈尔滨',
            boarding_floor: 'T3',
            status: '正常'
          }, {
            flights_number: 'MF8071',
            estimate_takeoff_time: '15:00',
            departure_place: '哈尔滨',
            boarding_floor: 'T3',
            status: '正常'
          }, {
            flights_number: 'MF8071',
            estimate_takeoff_time: '16:00',
            departure_place: '哈尔滨',
            boarding_floor: 'T3',
            status: '正常'
          }, {
            flights_number: 'MF8071',
            estimate_takeoff_time: '18:00',
            departure_place: '哈尔滨',
            boarding_floor: 'T3',
            status: '正常'
          }, {
            flights_number: 'MF8071',
            estimate_takeoff_time: '16:00',
            departure_place: '哈尔滨',
            boarding_floor: 'T3',
            status: '正常'
          }],
        flights_rank: {
          rank1: {
            IATA: 'CA',
            num: '62'
          },
          rank2: {
            IATA: 'MU',
            num: '55'
          },
          rank3: {
            IATA: '3U',
            num: '40'
          }
        },
        passengers_rank: {
          rank1: {
            IATA: 'CA',
            num: '62'
          },
          rank2: {
            IATA: 'MU',
            num: '55'
          },
          rank3: {
            IATA: '3U',
            num: '40'
          }
        },
        shipment_rank: {
          rank1: {
            IATA: 'CA',
            num: '62'
          },
          rank2: {
            IATA: 'MU',
            num: '55'
          },
          rank3: {
            IATA: '3U',
            num: '40'
          }
        },
        flights_count:12345,
        passengers_count:23456,
        shipment_count: 34567
      }
    },
    mounted () {
      this.initChart()
      this.getData()
    },
    methods: {
      // 初始化Echarts instance对象
      initChart () {
        this.chartInstance = this.$echarts.init(this.$refs.Flights_trajectory_ref)

      },
      // 获取后端数据
      async getData () {
        // 等后端写好后再测试
        /*const result = await this.$http.get('/flights_right_now')
        this.allData = result*/

        //将获取到到最新航班数据添加到 Departure_flights、Entry_flights 中

        this.updateChart()
        //启动定时器
        this.startInterval()
      },
      // 更新图表
      updateChart () {
        //清空series
        series.length = 0
        this.rendering_map()
        var option = {
          tooltip: {
            trigger: 'item',
            formatter: function (params, ticket, callback) {

              if (params.seriesType == 'effectScatter') {
                return '线路：' + params.data.name + '' + params.data.value[2]
              } else if (params.seriesType == 'lines') {
                return params.data.fromName + '->' + params.data.toName + '<br />' + '在飞航班' + params.data.value
              } else {
                return params.name
              }
            }
          },
          geo: {
            map: 'china',
            zoom: 1.2,
            label: {
              emphasis: {
                show: true
              }
            },
            roam: false,
            itemStyle: {
              normal: {
                // 地图省份的颜色
                areaColor: '#142957',
                // 地图省份边界的颜色
                borderColor: '#0692a4'
              },
              emphasis: {
                areaColor: '#fff'
              }
            }
          },
          series: series
        }
        this.chartInstance.setOption(option)
      },
      // 渲染地图
      rendering_map () {
        // 渲染所有离港航班的目标机场 涟漪效果
        Departure_flights.forEach(function (item, i) {
          let series_effectScatter_Departure = {
            name: 'entry_flights_airport',
            type: 'effectScatter', //带有涟漪特效动画的散点（气泡）图。利用动画特效可以将某些想要突出的数据进行视觉突出。
            coordinateSystem: 'geo', //该系列使用的坐标系
            zlevel: 2,
            rippleEffect: { //涟漪特效相关配置
              brushType: 'stroke',
              color: color[0],
            },
            label: {  //图形上的文本标签，可用于说明图形的一些数据信息，比如值，名称等
              show: true,
              position: 'top',
              formatter: '{b}'
            },
            symbolSize: function (val) {  //标记的大小
              return val[2] / 8
            },
            data: Departure_flights.map(function () {
              return {
                name: item[1].name,
                value: geoCoordMap[item[1].name].concat(item[1].value)
              }
            })
          }
          series.push(series_effectScatter_Departure)
        })
        // 绘制离港航班航线
        let Departure_flights_series_line1 = {
          name: 'Departure_flights_line1',
          type: 'lines', //用于带有起点和终点信息的线数据的绘制，主要用于地图上的航线，路线的可视化。
          zlevel: 1,
          effect: { //线特效的配置
            show: true,
            period: 6, //特效动画的时间
            trailLength: 0.7, //特效尾迹的长度。取从 0 到 1 的值，数值越大尾迹越长。
            color: 'red',   //arrow箭头的颜色
            symbolSize: 3 //特效标记的大小，可以设置成诸如 10 这样单一的数字，也可以用数组分开表示高和宽，例如 [20, 10] 表示标记宽为20，高为10。
          },
          lineStyle: {
            width: 0,
            curveness: 0.2 //边的曲度，支持从 0 到 1 的值，值越大曲度越大

          },
          data: convertData(Departure_flights) //线数据集。
        }
        let Departure_flights_series_line2 = {
          name: 'Departure_flights_line2',
          type: 'lines',
          zlevel: 2,
          symbol: ['none', 'arrow'],
          symbolSize: 10,
          effect: {
            show: true,
            period: 6,
            trailLength: 0,
            symbol: planePath,
            symbolSize: 15
          },
          lineStyle: {
            width: 1,
            opacity: 0.6,
            curveness: 0.2

          },
          data: convertData(Departure_flights)
        }
        // 将离港航班的飞行轨迹图注册到series中
        series.push(Departure_flights_series_line1, Departure_flights_series_line2)
        // 渲染重庆坐标点 涟漪效果
        let Chongqing_series_effectScatter = {
          name: '重庆_airport',
          type: 'effectScatter', //带有涟漪特效动画的散点（气泡）图。利用动画特效可以将某些想要突出的数据进行视觉突出。
          coordinateSystem: 'geo', //该系列使用的坐标系
          zlevel: 2,
          rippleEffect: { //涟漪特效相关配置
            brushType: 'stroke',
            color: color[0],
          },
          label: {  //图形上的文本标签，可用于说明图形的一些数据信息，比如值，名称等
            show: true,
            position: 'top',
            formatter: '{b}'
          },
          symbolSize: function (val) {  //标记的大小
            return val[2] / 8
          },
          data: Departure_flights.map(function () {
            return {
              name: '重庆',
              value: geoCoordMap['重庆'].concat(100)
            }
          })
        }
        series.push(Chongqing_series_effectScatter)

        // 渲染所有入港航班的始发机场 涟漪效果
        Entry_flights.forEach(function (item, i) {

          let series_effectScatter_Entry = {
            name: 'entry_flights_airport',
            type: 'effectScatter', //带有涟漪特效动画的散点（气泡）图。利用动画特效可以将某些想要突出的数据进行视觉突出。
            coordinateSystem: 'geo', //该系列使用的坐标系
            zlevel: 2,
            rippleEffect: { //涟漪特效相关配置
              brushType: 'stroke',
              color: color[0],
            },
            label: {  //图形上的文本标签，可用于说明图形的一些数据信息，比如值，名称等
              show: true,
              position: 'top',
              formatter: '{b}'
            },
            symbolSize: function (val) {  //标记的大小
              return val[2] / 8
            },
            data: Entry_flights.map(function () {
              return {
                name: item[0].name,
                value: geoCoordMap[item[0].name].concat(item[1].value)
              }
            })
          }
          series.push(series_effectScatter_Entry)
        })
        // 绘制入港航班航线
        let Entry_flights_series_line1 = {
          name: 'Entry_flights_line1',
          type: 'lines', //用于带有起点和终点信息的线数据的绘制，主要用于地图上的航线，路线的可视化。
          zlevel: 1,
          effect: { //线特效的配置
            show: true,
            period: 6, //特效动画的时间
            trailLength: 0.7, //特效尾迹的长度。取从 0 到 1 的值，数值越大尾迹越长。
            color: 'red',   //arrow箭头的颜色
            symbolSize: 3 //特效标记的大小，可以设置成诸如 10 这样单一的数字，也可以用数组分开表示高和宽，例如 [20, 10] 表示标记宽为20，高为10。
          },
          lineStyle: {
            width: 0,
            curveness: 0.2 //边的曲度，支持从 0 到 1 的值，值越大曲度越大

          },
          data: convertData(Entry_flights) //线数据集。
        }
        let Entry_flights_series_line2 = {
          name: 'Entry_flights_line1',
          type: 'lines',
          zlevel: 2,
          symbol: ['none', 'arrow'],
          symbolSize: 10,
          effect: {
            show: true,
            period: 6,
            trailLength: 0,
            symbol: planePath,
            symbolSize: 15
          },
          lineStyle: {
            width: 1,
            opacity: 0.6,
            curveness: 0.2

          },
          data: convertData(Entry_flights)
        }
        // 将入港航班的飞行轨迹图注册到series中
        series.push(Entry_flights_series_line1, Entry_flights_series_line2)
      },
      //定时器函数
      startInterval () {
        if (this.timer) {
          clearInterval(this.timer) //保险起见，如果开始执行定时函数之前，存在timer 则将其清空
        }
        this.timer = setInterval(() => {
          //每隔12s获取后端数据
          this.getData()
        }, 12000)
      }
    }
  }
</script>


<style scoped lang="less">
  * {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
  }

  li {
    list-style: none;
  }

  /* 声明字体*/
  @font-face {
    font-family: electronicFont;
    src: url(../assets/font/DS-DIGIT.TTF);
  }


  .main-box {
    display: flex;
    min-width: 1000px;
    max-width: 1920px;
    margin: 0 auto;
    padding: 0.125rem 0.125rem 0;

    .column {
      flex: 3;
    }

    .column:nth-child(2) {
      flex: 7;
      margin: 0 0.125rem 0.1875rem;
    }
  }

  .panel-top {
    position: relative; //绝对定位的元素的位置相对于最近的已定位祖先元素，如果元素没有已定位的祖先元素，那么它的位置相对于最初的包含块。
    height: 3.875rem;
    padding: 0 0.1875rem 0.5rem;
    border: 1px solid rgba(25, 186, 139, 0.17); //边框
    background: url("../assets/images/line.png") rgba(255, 255, 255, 0.05);

    h2 {
      height: 0.6rem;
      line-height: 0.6rem;
      text-align: center;
      color: #fff;
      font-size: 20px;
      font-weight: 400;
    }

    .chart {
      height: 3rem;

      .left-top-box {
        position: relative;
        display: flex;

        .column {
          flex: 3;
          height: 3rem;
        }

        h3 {
          color: #E6A23C;
          text-align: center;
          height: 0.5rem;
        }

        .panel-rank {
          display: flex;
          height: 0.625rem;
          font-size: 0.5rem;

          h4 {
            flex: 3;
            font-size: 0.2rem;
            color: white;
            text-align: center;
          }

          p {
            flex: 3;
            font-size: 0.2rem;
            color: white;
            text-align: center;
          }
        }


      }
      .right-top-box {
        width: 100%;
        height: 100%;
        .line {

          width: 100%;
          height: 1rem;
          padding-bottom: 0.125rem;
          .iconfont{
            font-size: 60px;
            color: #ffeb7b;
          }
          .span_title {
            font-size: 30px;
            color: #E6A23C;
            padding-left: 10px;
          }
          .span_value{
            display: inline-flex;
            font-size: 40px;
            color: white;
            margin-left: 20px;
          }
        }

      }


    }

    // 绘制边框等四角
    // 在当前元素的内容之前插入内容。
    &::before {
      position: absolute;
      top: 0;
      left: 0;
      content: '';
      width: 10px;
      height: 10px;
      border-top: 2px solid #02a6b5;
      border-left: 2px solid #02a6b5;
    }

    // 在当前元素的内容后面插入内容。
    &::after {
      position: absolute;
      top: 0;
      right: 0;
      content: "";
      width: 10px;
      height: 10px;
      border-top: 2px solid #02a6b5;
      border-right: 2px solid #02a6b5;
    }

    // 面板底部
    .panel-footer {
      position: absolute;
      left: 0;
      bottom: 0;
      width: 100%;

      &::before {
        position: absolute;
        bottom: 0;
        left: 0;
        content: "";
        width: 10px;
        height: 10px;
        border-bottom: 2px solid #02a6b5;
        border-left: 2px solid #02a6b5;
      }

      &::after {
        position: absolute;
        bottom: 0;
        right: 0;
        content: "";
        width: 10px;
        height: 10px;
        border-bottom: 2px solid #02a6b5;
        border-right: 2px solid #02a6b5;
      }
    }
  }

  .panel-bottom {
    position: relative; //绝对定位的元素的位置相对于最近的已定位祖先元素，如果元素没有已定位的祖先元素，那么它的位置相对于最初的包含块。
    height: 7.8rem;
    padding: 0 0.1875rem 0.5rem;
    border: 1px solid rgba(25, 186, 139, 0.17); //边框
    border-top-width: 0.15rem;
    background: url("../assets/images/line.png") rgba(255, 255, 255, 0.05);

    h2 {
      height: 0.6rem;
      line-height: 0.6rem;
      text-align: center;
      color: #fff;
      font-size: 20px;
      font-weight: 400;
    }

    .chart {
      height: 6.9rem;

    }


    // 绘制边框等四角
    // 在当前元素的内容之前插入内容。
    &::before {
      position: absolute;
      top: 0;
      left: 0;
      content: '';
      width: 10px;
      height: 10px;
      border-top: 2px solid #02a6b5;
      border-left: 2px solid #02a6b5;
    }

    // 在当前元素的内容后面插入内容。
    &::after {
      position: absolute;
      top: 0;
      right: 0;
      content: "";
      width: 10px;
      height: 10px;
      border-top: 2px solid #02a6b5;
      border-right: 2px solid #02a6b5;
    }

    // 面板底部
    .panel-footer {
      position: absolute;
      left: 0;
      bottom: 0;
      width: 100%;

      &::before {
        position: absolute;
        bottom: 0;
        left: 0;
        content: "";
        width: 10px;
        height: 10px;
        border-bottom: 2px solid #02a6b5;
        border-left: 2px solid #02a6b5;
      }

      &::after {
        position: absolute;
        bottom: 0;
        right: 0;
        content: "";
        width: 10px;
        height: 10px;
        border-bottom: 2px solid #02a6b5;
        border-right: 2px solid #02a6b5;
      }
    }
  }

  //flights_rank数字统计模块
  .flights_rank {
    background: rgba(101, 132, 226, 0.1);
    padding: 0.1875rem; // 15px的内边距
    .flights_rank-number {
      position: relative;
      border: 1px solid rgba(25, 186, 139, 0.17);

      &::before {
        position: absolute;
        top: 0;
        left: 0;
        content: '';
        width: 30px;
        height: 10px;
        border-top: 2px solid #02a6b5;
        border-left: 2px solid #02a6b5;
      }

      &::after {
        position: absolute;
        bottom: 0;
        right: 0;
        content: '';
        width: 30px;
        height: 10px;
        border-right: 2px solid #02a6b5;
        border-bottom: 2px solid #02a6b5;
      }

      ul {
        display: flex;

        li {
          position: relative;
          flex: 1;
          line-height: 1rem;
          font-size: 0.875rem;
          color: #ffeb7b;
          text-align: center;
          font-family: electronicFont;

        }

        #li-1 {
          &::after {
            position: absolute;
            content: '';
            top: 25%;
            right: 0;
            height: 50%;
            width: 1px;
            background: rgba(255, 255, 255, 0.2);
          }
        }


      }
    }
  }

  .flights_rank-title {
    ul {
      display: flex;

      li {
        flex: 1;
        text-align: center;
        height: 0.5rem;
        color: rgba(255, 255, 255, 0.7);
        font-size: 0.225rem;
        padding-top: 10px;
      }
    }
  }

  .map {
    position: relative;
    height: 9.625rem;

    .map-ball {
      width: 6.475rem;
      height: 6.475rem;
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      background: url("../assets/images/map.png") no-repeat;
      background-size: 100% 100%;
      opacity: 0.3;
    }

    .map-rotate1 {
      position: absolute;
      width: 8.0375rem;
      height: 8.0375rem;
      z-index: 2;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      background: url("../assets/images/lbx.png") no-repeat;
      background-size: 100% 100%;
      opacity: 0.6;
      animation: rotate1 15s linear infinite;
    }

    .map-rotate2 {
      position: absolute;
      width: 7.075rem;
      height: 7.075rem;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      background: url("../assets/images/jt.png") no-repeat;
      background-size: 100% 100%;
      opacity: 0.8;
      animation: rotate2 10s linear infinite;

    }

    .map-chart {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 90%;
      height: 9.625rem;
      z-index: 5;
    }

    //沿着中心点顺时针旋转360度
    @keyframes rotate1 {
      from {
        transform: translate(-50%, -50%) rotate(0deg);
      }
      to {
        transform: translate(-50%, -50%) rotate(360deg);
      }
    }
    // 沿着中心点逆时针旋转360度
    @keyframes rotate2 {
      from {
        transform: translate(-50%, -50%) rotate(0deg);
      }
      to {
        transform: translate(-50%, -50%) rotate(-360deg);
      }
    }
  }




</style>


